package com.qj.sys.event;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author dlw
 * @date 2025-06-03 16:16
 */
@Service
@Slf4j
public class PersonEventPublisher {
    @Resource
    private ApplicationEventPublisher applicationEventPublisher;

    /**
     * @param person
     * @description:创建人物信息
     * @author: dlw
     * @date: 2025/6/3 16:17
     */
    public void createPerson(Person person) {
        applicationEventPublisher.publishEvent(new PersonChangeEvent(person, "create"));
    }

    /**
     * @param person
     * @description:更新人物信息
     * @author: dlw
     * @date: 2025/6/3 16:17
     */
    public void updatePerson(Person person) {
        applicationEventPublisher.publishEvent(new PersonChangeEvent(person, "update"));
    }
}
